package codeRandomThoughts.Test104二叉树的最大深度;

import codeRandomThoughts.utils.TreeNode;

//二刷
public class Solution3 {
    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        }

        //单层逻辑
        int left = maxDepth(root.left);
        int right = maxDepth(root.right);
        return Math.max(left, right) + 1;
    }
}
